using System.Web.Mvc;
using RelationalLinqToSql.Models;

namespace RelationalLinqToSql.Controllers
{
    public class PlacesController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Provinces"] = IranPlacesDataContext.GetProvinces();

            return View();
        }

        public ActionResult Province(int id)
        {
            ViewData["Title"] = IranPlacesDataContext.GetProvince(id).Name;
            ViewData["Places"] = IranPlacesDataContext.GetPlaces(id);

            return View();
        }

        public ActionResult Place(int id)
        {
            Place place = IranPlacesDataContext.GetPlace(id);

            ViewData["Title"] = place.Name;
            ViewData["Place"] = place;

            return View();
        }
    }
}
